Skip to content

Optimisation: avoid emitting type tests for verify bounds that always hold#152579

Open
amandasystems wants to merge 1 commit intorust-lang:mainfrom
amandasystems:skip-useless-type-tests
Open

Optimisation: avoid emitting type tests for verify bounds that always hold#152579
amandasystems wants to merge 1 commit intorust-lang:mainfrom
amandasystems:skip-useless-type-tests

Conversation

@amandasystems
Copy link
Contributor

@amandasystems amandasystems commented Feb 13, 2026

This makes more sense than you'd imagine since empty All bounds which always hold are is a relatively common use of them and a bound that always holds produces no promoted constraints.

r? @lcnr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 13, 2026
… hold

This makes more sense than you'd imagine since empty `All` bounds which
always hold is relatively common.
@amandasystems amandasystems force-pushed the skip-useless-type-tests branch from d55cf4c to 6b612a0 Compare February 13, 2026 16:21
if bound.must_hold() {
debug!("Bound {bound:?} always holds; emitting no type test.");
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels potentially quite surprising to me.

can we instead avoid constructing these verify bounds in the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants